use rbatis::rbdc::DateTime;

#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Reply {
    pub id: Option<u64>,
    pub cid: Option<u64>,
    pub pname: Option<String>,
    pub pcontent: Option<String>,
    pub rcontent: Option<String>,
    pub ptime: Option<DateTime>,
    pub isn: Option<u32>,
}

crud!(Reply {});

//查询最新回复
impl_select!(Reply{select_latest() => "`where isn=0 order by ptime desc limit 10`"});

//分页查询
impl_select_page!(Reply{select_page() =>"
      ` where 1=1`
      if !sql.contains('count(1)'):
        ` order by isn desc,ptime desc`"});
